package com.jc.constant;

public enum CountryEnum {


    CHN("CHN", "中国"),
    USA("USA", "美国");

    private final String code;
    private final String name;

    CountryEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static CountryEnum getByCode(String code) {
        for (CountryEnum item : CountryEnum.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
}